/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * LaunchWindow.java
 *
 * Created on 12.10.2009, 09:55:08
 */

package at.nhmwien.schema_mapping_tool;

import javax.swing.*;

/**
 *
 * @author wkoller
 */
public class LaunchWindow extends javax.swing.JApplet {

    MainWindow mw = null;

    /** Initializes the applet LaunchWindow */
    public void init() {
        try {
            final String inputSchema = getParameter( "inputSchema" );
            final String outputSchema = getParameter( "outputSchema" );

            java.awt.EventQueue.invokeAndWait(new Runnable() {
                public void run() {
                    // Set look & feel to system
                    try {
                        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    }
                    catch( Exception ex) {
                        ex.printStackTrace();
                    }

                    initComponents();

                    mw = MainWindow.Self();
                    mw.setSize(1024, 768);

                    if( inputSchema != null ) {
                        mw.openSchema( MainWindow.FIELD_INPUT, inputSchema );
                    }
                    if( outputSchema != null ) {
                        mw.openSchema( MainWindow.FIELD_OUTPUT, outputSchema );
                    }

                    mw.setVisible(true);
                }
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /** This method is called from within the init() method to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Launching Schema Mapping Tool...");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables

}
